package com.advertisementsystem.Mapper;

import com.advertisementsystem.entity.ChatSessions;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.Optional;

/**
 * <p>
 * 聊天会话表 Mapper 接口
 * </p>
 *
 * @author ccc
 * @since 2025-03-03
 */
@Mapper
public interface ChatSessionsMapper extends BaseMapper<ChatSessions> {


    @Update("UPDATE chat_sessions s SET s.unread_count = s.unread_count + 1, s.updated_time = CURRENT_TIMESTAMP WHERE s.session_id = #{sessionId}")
    void incrementUnreadCount(@Param("sessionId") Long sessionId);



}
